# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libwpd

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.10.0
pkgrel=1
pkgdesc="Library for Importing WordPerfect (tm) Documents (mingw-w64)"
arch=('any')
url="http://libwpd.sourceforge.net/"
license=("LGPL-2.1+" "MPL-2.0+")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-librevenge" "${MINGW_PACKAGE_PREFIX}-zlib" "${MINGW_PACKAGE_PREFIX}-xz")
options=(staticlibs strip)
source=("http://downloads.sourceforge.net/project/${_realname}/${_realname}/${_realname}-${pkgver}/${_realname}-${pkgver}.tar.xz")
md5sums=('f7abb9b3ea96faf02ae019af68b1f07c')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

build() {
  export lt_cv_deplibs_check_method='pass_all'
  cp -r ${srcdir}/${_realname}-${pkgver} "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static \
    --without-docs \
    --disable-werror
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="$pkgdir" install
  find "${pkgdir}${MINGW_PREFIX}" -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
}
